/**
 * 缩放
 * @param radio 画布大小比例
 * @param color 颜色
 * @returns 数据地址
 */
const ZoomImage = (radio?: number, color?: string) => {
    const r = radio || 1;
    const col = color || '#ffffff';
    const canvas = document.createElement('canvas');
    canvas.width = canvas.height = 40 * r;
    const ctx = canvas.getContext('2d')!;

    ctx.miterLimit = 4;
    ctx.fillStyle = col;
    ctx.miterLimit = 4;
    ctx.scale(0.032, 0.032);
    ctx.translate(95 * r, 95 * r);
    ctx.beginPath();
    ctx.moveTo(362.837 * r, 633.856 * r);
    ctx.lineTo(236.544 * r, 760.149 * r);
    ctx.lineTo(136.534 * r, 659.797 * r);
    ctx.lineTo(136.534 * r, 921.6 * r);
    ctx.lineTo(397.99399999999997 * r, 921.6 * r);
    ctx.lineTo(297.302 * r, 821.248 * r);
    ctx.lineTo(423.937 * r, 694.955 * r);
    ctx.closePath();
    ctx.moveTo(397.653 * r, 136.53300000000002 * r);
    ctx.lineTo(136.53300000000002 * r, 136.53300000000002 * r);
    ctx.lineTo(136.53300000000002 * r, 398.336 * r);
    ctx.lineTo(236.544 * r, 297.98400000000004 * r);
    ctx.lineTo(362.837 * r, 424.27700000000004 * r);
    ctx.lineTo(423.936 * r, 363.52000000000004 * r);
    ctx.lineTo(297.301 * r, 236.88500000000005 * r);
    ctx.closePath();
    ctx.moveTo(694.272 * r, 633.856 * r);
    ctx.lineTo(633.173 * r, 694.955 * r);
    ctx.lineTo(759.808 * r, 821.248 * r);
    ctx.lineTo(659.456 * r, 921.6 * r);
    ctx.lineTo(921.6 * r, 921.6 * r);
    ctx.lineTo(921.6 * r, 659.797 * r);
    ctx.lineTo(821.248 * r, 760.15 * r);
    ctx.closePath();
    ctx.moveTo(659.456 * r, 136.53300000000002 * r);
    ctx.lineTo(759.808 * r, 236.88500000000002 * r);
    ctx.lineTo(633.173 * r, 363.18 * r);
    ctx.lineTo(694.272 * r, 424.278 * r);
    ctx.lineTo(820.907 * r, 297.985 * r);
    ctx.lineTo(921.6 * r, 398.336 * r);
    ctx.lineTo(921.6 * r, 136.533 * r);
    ctx.closePath();
    ctx.moveTo(659.456 * r, 136.53300000000002 * r);
    ctx.fill();
    ctx.stroke();

    return canvas.toDataURL('image/png');
}


export { ZoomImage };